package cn.jobstart.service.impl;

import cn.jobstart.common.BeanUtils;
import cn.jobstart.vo.ResumeEducationalExperienceDomainVO;
import cn.jobstart.vo.ResumeEmploymentIntentionMiniDomainVO;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import cn.jobstart.modelExt.ResumeEmploymentIntentionExt;
import cn.jobstart.dao.IResumeEmploymentIntentionDao;
import cn.jobstart.searchExt.ResumeEmploymentIntentionSearchExt;
import cn.jobstart.pubInter.IBaseDao;
import cn.jobstart.pubInter.AbstractBaseService;
import cn.jobstart.service.IResumeEmploymentIntentionService;
import lombok.extern.slf4j.Slf4j;
import cn.jobstart.common.StringUtil;
import cn.jobstart.common.SkList;
import cn.jobstart.pubInter.exception.SkException;

import java.util.List;
import java.util.stream.Collectors;


/**
 * @author sunke
 * @Date 2023-09-06 15:00:21
 * @description ResumeEmploymentIntentionService      求职意向
 */
@Service(value = "resumeEmploymentIntentionService")
@Slf4j
public class ResumeEmploymentIntentionServiceImpl extends AbstractBaseService<ResumeEmploymentIntentionExt, ResumeEmploymentIntentionSearchExt, String> implements IResumeEmploymentIntentionService {

    @Resource(name = "resumeEmploymentIntentionDao")
    private IResumeEmploymentIntentionDao resumeEmploymentIntentionDao;

    @Override
    public IBaseDao<ResumeEmploymentIntentionExt, ResumeEmploymentIntentionSearchExt, String> getDao() {
        return resumeEmploymentIntentionDao;
    }




    /**
     * @param resumeId
     * @return
     */
    @Override
    public String getEmploymentIntentionStrByResumeId(String resumeId) {
        try {
            List<ResumeEmploymentIntentionExt> list = getListByResumeId(resumeId);


            return StringUtil.getJsonArrayStrByList(list,ResumeEmploymentIntentionMiniDomainVO.class);


        } catch (Exception e) {

        }
        return "";
    }

    /**
     * 简历ID 得到列表
     *
     * @param resumeId
     * @return
     */
    @Override
    public List<ResumeEmploymentIntentionExt> getListByResumeId(String resumeId) {
        if (StringUtil.isNullOrEmpty(resumeId)) {
            return null;
        }
        try {
            return getAllList(ResumeEmploymentIntentionSearchExt.getInstance().setResumesIdEq(resumeId));
        } catch (SkException e) {
            return null;
        }
    }
}